home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / Tools / vg-2.03 / video / v86mode.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-03  |  2.3 KB  |  96 lines

  1. /*
  2.  * Copyright (C) 1990-1992 Michael Davidson.
  3.  * All rights reserved.
  4.  *
  5.  * Permission to use, copy, modify, and distribute this software
  6.  * and its documentation for any purpose and without fee is hereby
  7.  * granted, provided that the above copyright notice appear in all
  8.  * copies and that both that copyright notice and this permission
  9.  * notice appear in supporting documentation.
  10.  *
  11.  * This software is provided "as is" without express or implied warranty.
  12.  */
  13.  
  14. #ifndef    V86MODE_H
  15. #define    V86MODE_H
  16.  
  17. #include    <sys/types.h>
  18. #include    <sys/tss.h>
  19.  
  20. #include    "v86types.h"
  21.  
  22.  
  23. int    V86Init();
  24. int    V86MemMap(paddr_t, caddr_t, int);
  25. int    V86MemUnmap(paddr_t, caddr_t, int);
  26. int    V86IOEnable(unsigned, int);
  27. int    V86IODisable(unsigned, int);
  28. int    V86Run();
  29. char    *V86ErrorMessage(int);
  30.  
  31. /*
  32.  * return values from V86Emulate()
  33.  */
  34. #define    ERR_V86_HALT        (-1)
  35. #define    ERR_V86_DIV0        (-2)
  36. #define    ERR_V86_SGLSTP        (-3)
  37. #define    ERR_V86_BRKPT        (-4)
  38. #define    ERR_V86_OVERFLOW    (-5)
  39. #define    ERR_V86_BOUND        (-6)
  40. #define    ERR_V86_ILLEGAL_OP    (-7)
  41. #define    ERR_V86_ILLEGAL_IO    (-8)
  42.  
  43. /*
  44.  * the V86 mode TSS
  45.  */
  46. extern struct tss386    *v86tss;
  47.  
  48. /*
  49.  * macros for accessing 8, 16 and 32 bit registers in a TSS
  50.  */
  51. #define EAX(t)    ((t)->t_eax)
  52. #define AX(t)    WORD(0, (t)->t_eax)
  53. #define AH(t)    BYTE(1, (t)->t_eax)
  54. #define AL(t)    BYTE(0, (t)->t_eax)
  55.  
  56. #define EBX(t)    ((t)->t_ebx)
  57. #define BX(t)    WORD(0, (t)->t_ebx)
  58. #define BH(t)    BYTE(1, (t)->t_ebx)
  59. #define BL(t)    BYTE(0, (t)->t_ebx)
  60.  
  61. #define ECX(t)    ((t)->t_ecx)
  62. #define CX(t)    WORD(0, (t)->t_ecx)
  63. #define CH(t)    BYTE(1, (t)->t_ecx)
  64. #define CL(t)    BYTE(0, (t)->t_ecx)
  65.  
  66. #define EDX(t)    ((t)->t_edx)
  67. #define DX(t)    WORD(0, (t)->t_edx)
  68. #define DH(t)    BYTE(1, (t)->t_edx)
  69. #define DL(t)    BYTE(0, (t)->t_edx)
  70.  
  71. #define ESI(t)    ((t)->t_esi)
  72. #define SI(t)    WORD(0, (t)->t_esi)
  73.  
  74. #define EDI(t)    ((t)->t_edi)
  75. #define DI(t)    WORD(0, (t)->t_edi)
  76.  
  77. #define EBP(t)    ((t)->t_ebp)
  78. #define BP(t)    WORD(0, (t)->t_ebp)
  79. #define ESP(t)    ((t)->t_esp)
  80. #define SP(t)    WORD(0, (t)->t_esp)
  81.  
  82. #define DS(t)    WORD(0, (t)->t_ds)
  83. #define ES(t)    WORD(0, (t)->t_es)
  84. #define SS(t)    WORD(0, (t)->t_ss)
  85. #define CS(t)    WORD(0, (t)->t_cs)
  86. #define FS(t)    WORD(0, (t)->t_fs)
  87. #define GS(t)    WORD(0, (t)->t_gs)
  88.  
  89. #define EIP(t)    ((t)->t_eip)
  90. #define IP(t)    WORD(0, (t)->t_eip)
  91.  
  92. #define EFL(t)    ((t)->t_eflags)
  93. #define FL(t)    WORD(0, (t)->t_eflags)
  94.  
  95. #endif    /* V86MODE_H */
  96.